<?php

    $ddd   = $_POST["ddd"];
    $indice = $_POST["id"];


    include("conexao.php");

    $query = "update ddd set numero='".$ddd."' where id_ddd=".$indice;
    $res   = mysql_query($query,$conexao);
 
    

    if($res)
    {
       echo "
		<META HTTP-EQUIV=REFRESH CONTENT='0; URL=cad_ddd.php'>
		<script type=\"text/javascript\">
		alert(\"DDD alterado com sucesso.\");
		</script>
		";
			
    }
    else
    {
       echo "
		<META HTTP-EQUIV=REFRESH CONTENT='0; URL=cad_ddd.php'>
		<script type=\"text/javascript\">
		alert(\"Erro ao alterar DDD.\");
		</script>
		";
			
    }

?>